﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MNCServer
{
    public class CrossfireServer : Server
    {
        /**
         * @start mncds.exe server 
         * HostileLobby?game=HostileGame.HGameInfo_PreGameLobby?
         * bAllowJuicePurch=True?bAllowBotPurch=True?bAllowHazards=True?
         * bAllowMascot=True?bAllowCustomClass=True?bAllowChangeClass=True?
         * bForceRndClass=False?bIsLanMatch=False?bIsDedicated=True?
         * bAllowTeamSelect=True?bAutoBalance=True?MatchDuration=2?OTDuration=2?
         * ClassLimitAssault=6?ClassLimitTank=6?ClassLimitSupport=6?ClassLimitAssassin=6?
         * ClassLimitGunner=6?ClassLimitSniper=6?MinNumToStart=6?
         * ServerDescription="MNCDS - Standard" -ServerInstance=0 
         * -log=DedicatedServer.log -STEAM_DEDSERVER -seekfreeloadingserver -nohomedir
         **/
        public bool AllowJuicePurchase { get; set; }
        public bool AllowBotPurchase { get; set; }
        public bool AllowHazards { get; set; }
        public bool AllowMascot { get; set; }
        public bool AllowCustomClasses { get; set; }
        public bool AllowChangeClass { get; set; }
        public bool ForceRandomClass { get; set; }
        public bool IsLanMatch { get; set; }
        public bool AllowTeamSelect { get; set; }
        public bool AutoBalance { get; set; }
        public int MatchDuration { get; set; }
        public int OvertimeDuration { get; set; }
        public short ClassLimitAssault { get; set; }
        public short ClassLimitTank { get; set; }
        public short ClassLimitSupport { get; set; }
        public short ClassLimitAssassin { get; set; }
        public short ClassLimitGunner { get; set; }
        public short ClassLimitSniper { get; set; }
        public short MinPlayersToStart { get; set; }
        public short MaxStarRating { get; set; }

        public CrossfireServer()
        {
            AllowJuicePurchase = true;
            AllowBotPurchase = true;
            AllowHazards = true;
            AllowMascot = true;
            AllowCustomClasses = true;
            AllowChangeClass = true;
            ForceRandomClass = false;
            IsLanMatch = false;
            AllowTeamSelect = true;
            AutoBalance = true;
            MatchDuration = 2;
            OvertimeDuration = 2;
            ClassLimitAssault = 6;
            ClassLimitTank = 6;
            ClassLimitSupport = 6;
            ClassLimitAssassin = 6;
            ClassLimitGunner = 6;
            ClassLimitSniper = 6;
            MinPlayersToStart = 2;
            MaxStarRating = 5;
        }

        public override string ToString()
        {
            return string.Format
                ("server HostileLobby?game=HostileGame.HGameInfo_PreGameLobby?" +
                "bAllowJuicePurch={0}?bAllowBotPurch={1}?bAllowHazards={2}?bAllowMascot={3}?bAllowCustomClass={4}?" +
                "bAllowChangeClass={5}?bForceRndClass={6}?bIsLanMatch={7}?bIsDedicated={8}?bAllowTeamSelect={9}?" +
                "bAutoBalance={10}?MatchDuration={11}?OTDuration={12}?ClassLimitAssault={13}?ClassLimitTank={14}?ClassLimitSupport={15}?" +
                "ClassLimitAssassin={16}?ClassLimitGunner={17}?ClassLimitSniper={18}?MaxStarRating={19}?MinNumToStart={20}?" +
                "ServerDescription=\"{21}\"{22} " + 
                "-ServerInstance=0 -log=DedicatedServer.log -STEAM_DEDSERVER -seekfreeloadingserver -nohomedir",
                AllowJuicePurchase, AllowBotPurchase, AllowHazards, AllowMascot, AllowCustomClasses,
                AllowChangeClass, ForceRandomClass, IsLanMatch, true, AllowTeamSelect,
                AutoBalance, MatchDuration, OvertimeDuration, ClassLimitAssault, ClassLimitTank, ClassLimitSupport,
                ClassLimitAssault, ClassLimitGunner, ClassLimitSniper, MaxStarRating, MinPlayersToStart, Name,
                (IsPassworded ? "?GamePassword=" + Password : ""));
        }
    }

}
